# the minimum version of CMake.
cmake_minimum_required(VERSION 3.4.1)
project(ffmpeg_invoker)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")

# 设置ffmpeg库所在路径的目录
set(distribution_DIR ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH})

# 编译一个ffmpeg-invoker库
add_library(ffmpeg_invoker SHARED
           log/ohos_log.cpp
           ffmpeg_thread/ffmpeg_thread.c
           ffmpeg/cmdutils.c
           ffmpeg/ffmpeg.c
           ffmpeg/ffmpeg_filter.c
           ffmpeg/ffmpeg_opt.c
           ffmpeg/log.c
           main/main_handler.cpp
           )

# 添加libffmpeg.so库
add_library(ffmpeg
        SHARED
        IMPORTED )


# 指定libffmpeg.so库的位置
set_target_properties( ffmpeg
        PROPERTIES IMPORTED_LOCATION
        ${distribution_DIR}/libffmpeg.so)

# 添加头文件路径
include_directories(
        ${CMAKE_SOURCE_DIR}/include
        ${CMAKE_SOURCE_DIR}/ffmpeg
)


target_link_libraries(ffmpeg_invoker ffmpeg)
target_link_libraries(ffmpeg_invoker hilog_ndk.z)
target_link_libraries(ffmpeg_invoker ace_napi.z)